package com.yjz.designpattern.访问者模式;

// 具体访问者：价格访问者
class PriceVisitor implements Visitor {
    @Override
    public void visit(Book book) {
        System.out.println("Book price: $" + book.getPrice());
    }

    @Override
    public void visit(Fruit fruit) {
        System.out.println("Fruit price: $" + fruit.getPricePerKg() + " per kg");
    }
}